﻿<UserControl x:Class="Framework.UI.TestHarness.Views.ThicknessView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:params="http://schemas.codeplex.com/elysium/params"
             xmlns:extra="http://schemas.extra.com/ui"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        
        <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource HeaderTextStyle}"
                   Text="Possible Improvements"/>
        <TextBlock Grid.Row="1" 
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource NormalTextStyle}" 
                   Text="Using Bindings and Converters for Margins and Paddings is more CPU intensive and hard to read the XAML. Using static Thickness resources would be a better option. The could be named BoldThickness, BoldLeftThickness, BoldTopThickness, BoldRightThickness, BoldBottomThickness, etc. It would not be too difficult to list them all."/>

        <TextBlock Grid.Row="2" 
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource HeaderTextStyle}"
                   Text="Margin &amp; Padding"/>
        <TextBlock Grid.Row="3" 
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource NormalTextStyle}" 
                   Text="Margins are dynamically controlled, we should be able to change these at runtime. Do not specify a padding or margin yourself. Use Binding like this:"/>
        <Border Grid.Row="4" 
                Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                Style="{StaticResource BorderStyle}">
            <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                       Style="{StaticResource NormalTextStyle}" 
                       Text="All round Margin, {Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"/>
        </Border>

        <TextBlock Grid.Row="5" 
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource HeaderTextStyle}"
                   Text="Custom Margins or Padding"/>
        <TextBlock Grid.Row="6" 
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource NormalTextStyle}" 
                   Text="You can specify the direction of binding like so:"/>
        <Border Grid.Row="7" 
                Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                Style="{StaticResource BorderStyle}">
            <TextBlock Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Top', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                       Style="{StaticResource NormalTextStyle}" 
                       Text="Left and Top Margin Only, {Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Right', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"/>
        </Border>

        <TextBlock Grid.Row="8" 
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource HeaderTextStyle}"
                   Text="Bad Margins"/>
        <TextBlock Grid.Row="9" 
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource NormalTextStyle}" 
                   Text="Both borders below have all around margins. This means that there is a double margin between them."/>
        <Grid Grid.Row="10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Border Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                    Style="{StaticResource BorderStyle}"/>
            <Border Grid.Column="1" 
                    Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                    Style="{StaticResource BorderStyle}"/>
        </Grid>

        <TextBlock Grid.Row="11"
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource HeaderTextStyle}"
                   Text="Good Margins"/>
        <TextBlock Grid.Row="12"
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource NormalTextStyle}" 
                   Text="The margin between these two borders is uniform."/>
        <Grid Grid.Row="13">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Border Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                    Style="{StaticResource BorderStyle}"/>
            <Border Grid.Column="1" 
                    Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Top, Right, Bottom', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                    Style="{StaticResource BorderStyle}"/>
        </Grid>

    </Grid>
</UserControl>
